import axios from 'axios'

// const baseURL = 'http://localhost:8888/api/private/v1/' 
const baseURL = 'https://leather.ztazy.cn/lp-1.0.0-SNAPSHOT/' 
// const baseURL = 'http://192.168.0.194:3031/' 
const phpURL = 'https://leather.ztazy.cn/ueditor/php/controller.php'
axios.defaults.baseURL = baseURL

// 添加请求拦截器
axios.interceptors.request.use(function (config) {
  // 将token给到一个前后台约定好的key中，作为请求发送
  let token = localStorage.getItem('mytoken')
  if (token) {
    config.headers['Authorization'] = token
  }
  return config
}, function (error) {
  // Do something with request error
  return Promise.reject(error)
})
// 登录验证
export const PHPURL = phpURL
// 登录验证
export const BASEURL = baseURL
// 登录验证
export const checkUser = params => {
    return axios.post('sys/session/create', params).then(res => res.data)
  }
  // 修改密码
export const Upassword = params => {
  return axios.post('sys/session/user/password', params).then(res => res.data)
}
// 信息管理
export const getUserList = params => {
  return axios.get('enterprise/information/page', params).then(res => res.data)
}
// 验证码
export const checkUserImg = params => {
    return axios.get(`sys/code/image/${params}`,{responseType: 'arraybuffer'}).then(res => res)
}
// 根据id获取用户信息
export const getUserById = params => {
  return axios.get(`enterprise/information/find/one`,params).then(res => res.data)
}
// 删除用户信息
export const deleteUser = params => {
  return axios.delete(`enterprise/information/delete`,params).then(res => res.data)
}
// 添加用户
export const addUser = params => {
  return axios.post('enterprise/information/create', params).then(res => res.data)
}
// 编辑用户信息
export const editUser = params => {
  return axios.post(`enterprise/information/update`, params).then(res => res.data)
}
// 重置初始密码
export const resetUser = params => {
  return axios.get(`enterprise/information/reset_password`, params).then(res => res.data)
}
// 模糊查询
export const fuzzyUser = params => {
  return axios.get(`enterprise/information/page/enterpriseInformationId`, params).then(res => res.data)
}
// 缴费接口
// 列表
export const PayList = params => {
  return axios.get(`lookup/details/page/not`, params).then(res => res.data)
}
// 更新
export const addPay = params => {
  return axios.post(`lookup/details/excel`, params).then(res => res.data)
}
// 更新
export const editPay = params => {
  return axios.post(`lookup/details/update`, params).then(res => res.data)
}
// 缴费
export const PayAble = params => {
  return axios.get(`lookup/details/update/history/payable`, params).then(res => res.data)
}
// 历史缴费
export const historyPayAble = params => {
  return axios.get(`lookup/details/history/payable`, params).then(res => res.data)
}
// 会议室接口
// 列表
export const getMeetList = params => {
  return axios.get(`meeting/room/page/meeting/room`, params).then(res => res.data)
}
// 添加列表
export const addMeetList = params => {
  return axios.post(`meeting/room/create`, params).then(res => res.data)
}
// 编辑
export const editMeetList = params => {
  return axios.post(`meeting/room/update_one`, params).then(res => res.data)
}
// 删除
export const deleteMeetList = params => {
  return axios.delete(`meeting/room/delete`, params).then(res => res.data)
}
// 图片上传
export const Meetimage = params => {
  return axios.delete(`meeting/room/delete`, params).then(res => res.data)
}
// 会议室申请记录接口
// 列表
export const getMeetapplyList = params => {
  return axios.get(`field/application/page/field/enterprise/name`, params).then(res => res.data)
}
// 添加列表
export const addMeetapplyList = params => {
  return axios.post(`field/application/create`, params).then(res => res.data)
}
// 编辑
export const editMeetapplyList = params => {
  return axios.post(`field/application/update`, params).then(res => res.data)
}
// 删除
export const deleteMeetapplyList = params => {
  return axios.delete(`field/application/delete`, params).then(res => res.data)
}
// 删除
export const statusMeetapplyList = params => {
  return axios.post(`field/application/update/status?fieldApplicationId=${params}`).then(res => res.data)
}
// 保修接口
// 列表
export const RepairList = params => {
  return axios.get(`iwant/to/repair/page/iwant/enterprise/name`, params).then(res => res.data)
}
// 受理状态
export const iwantRepair = params => {
  return axios.get(`iwant/to/repair/update/one/iwant`, params).then(res => res.data)
}
// 编辑
export const editRepair = params => {
  return axios.post(`iwant/to/repair/update`, params).then(res => res.data)
}
// 完成状态
export const iwantcomRepair = params => {
  return axios.get(`iwant/to/repair/update/iwant`, params).then(res => res.data)
}
// 删除
export const deleteRepair = params => {
  return axios.delete(`iwant/to/repair/web/delete`, params).then(res => res.data)
}
// 新闻接口
// 列表
export const newsList = params => {
  return axios.get(`news/page/news`, params).then(res => res.data)
}
// 添加
export const addNews = params => {
  return axios.post(`news/create`, params).then(res => res.data)
}
// 编辑
export const editNews = params => {
  return axios.post(`news/update_one`, params).then(res => res.data)
}
// 删除
export const deleteNews = params => {
  return axios.delete(`news/delete`, params).then(res => res.data)
}
// 活动接口
// 列表
export const activityList = params => {
  return axios.get(`activity_information/page`, params).then(res => res.data)
}
// 添加
export const addactivity = params => {
  return axios.post(`activity_information/create`, params).then(res => res.data)
}
// 编辑
export const editactivity = params => {
  return axios.post(`activity_information/update`, params).then(res => res.data)
}
// 删除
export const deleteactivity = params => {
  return axios.delete(`activity_information/delete`, params).then(res => res.data)
}
// 申请活动列表
export const activity_applylist = params => {
  return axios.get(`activity_apply/page`, params).then(res => res.data)
}
export const deleteactivity_apply = params => {
  return axios.delete(`activity_apply/delete`, params).then(res => res.data)
}
// 公告接口
// 列表
export const announceList = params => {
  return axios.get(`information/publish/page/information/title`, params).then(res => res.data)
}
// 添加
export const addannounce = params => {
  return axios.post(`information/publish/create`, params).then(res => res.data)
}
// 编辑
export const editannounce = params => {
  return axios.post(`information/publish/update`, params).then(res => res.data)
}
// 删除
export const deleteannounce = params => {
  return axios.delete(`information/publish/delete`, params).then(res => res.data)
}
// 工商注册
// 列表
export const InCoRegList = params => {
  return axios.get(`business/registration/page/business/registration/company/name`, params).then(res => res.data)
}
// 添加
export const addInCoReg = params => {
  return axios.post(`business/registration/create`, params).then(res => res.data)
}
// 编辑
export const editInCoReg = params => {
  return axios.post(`business/registration/update_one`, params).then(res => res.data)
}
// 删除
export const deleteInCoReg = params => {
  return axios.delete(`business/registration/delete`, params).then(res => res.data)
}
// 工商变更
export const InCochaList = params => {
  return axios.get(`business/modification/page/business/modification/company/name`, params).then(res => res.data)
}
// 添加
export const addInCocha = params => {
  return axios.post(`business/modification/create`, params).then(res => res.data)
}
// 编辑
export const editInCocha = params => {
  return axios.post(`business/modification/update_one`, params).then(res => res.data)
}
// 删除
export const deleteInCocha = params => {
  return axios.delete(`business/modification/delete`, params).then(res => res.data)
}
// 获取单个信息
export const InCochaoneList = params => {
  return axios.get(`business/modification/page/one?modificationId=${params}`).then(res => res.data)
}
// 添加服务需求
export const addInCochaservice = params => {
  return axios.post(`business/modification/group/create`, params).then(res => res.data)
}
// 服务需求列表
export const addInCochaservicelist = params => {
  return axios.get(`business/modification/group/page`, params).then(res => res.data)
}
// 删除列表
export const deleteInCochaservice = params => {
  return axios.delete(`business/modification/group/delete`, params).then(res => res.data)
}
// 商标注册
export const TraRegList = params => {
  return axios.get(`trademark/registration/page/trademark/registration`, params).then(res => res.data)
}
// 添加
export const addTraReg = params => {
  return axios.post(`trademark/registration/create`, params).then(res => res.data)
}
// 编辑
export const editTraReg = params => {
  return axios.post(`trademark/registration/update_one`, params).then(res => res.data)
}
// 删除
export const deleteTraReg = params => {
  return axios.delete(`trademark/registration/delete`, params).then(res => res.data)
}
// 专利申请
export const PatentList = params => {
  return axios.get(`patent/application/page/patent/application/service`, params).then(res => res.data)
}
// 添加
export const addPatent = params => {
  return axios.post(`patent/application/create`, params).then(res => res.data)
}
// 编辑
export const editPatent = params => {
  return axios.post(`patent/application/update_one`, params).then(res => res.data)
}
// 删除
export const deletePatent = params => {
  return axios.delete(`patent/application/delete`, params).then(res => res.data)
}
// 获取单个信息
export const PatentoneList = params => {
  return axios.get(`patent/application/page/one?patentId=${params}`).then(res => res.data)
}
// 添加服务需求
export const addPatentservice = params => {
  return axios.post(`patent/application/group/create`, params).then(res => res.data)
}
// 服务需求列表
export const addPatentservicelist = params => {
  return axios.get(`patent/application/group/page`, params).then(res => res.data)
}
// 删除列表
export const deletePatentservice = params => {
  return axios.delete(`patent/application/group/delete`, params).then(res => res.data)
}
// 法律服务
export const LegSerList = params => {
  return axios.get(`legal/service/page/legal/service`, params).then(res => res.data)
}
// 添加
export const addLegSer = params => {
  return axios.post(`legal/service/create`, params).then(res => res.data)
}
// 编辑
export const editLegSer = params => {
  return axios.post(`legal/service/update_one`, params).then(res => res.data)
}
// 删除
export const deleteLegSer = params => {
  return axios.delete(`legal/service/delete`, params).then(res => res.data)
}
// 获取单个信息
export const LegSeroneList = params => {
  return axios.get(`legal/service/page/one?legalId=${params}`).then(res => res.data)
}
// 添加服务类型
export const addLegSerservice = params => {
  return axios.post(`legal/service/group/create`, params).then(res => res.data)
}
// 服务类型列表
export const addLegSerservicelist = params => {
  return axios.get(`legal/service/group/page`, params).then(res => res.data)
}
// 删除类型列表
export const deleteLegSerservice = params => {
  return axios.delete(`legal/service/group/delete`, params).then(res => res.data)
}
// 添加服务项目
export const addLegSerNextservice = params => {
  return axios.post(`legal/services/group/create`, params).then(res => res.data)
}
// 服务项目列表
export const addLegSerNextservicelist = params => {
  return axios.get(`legal/services/group/page`, params).then(res => res.data)
}
// 删除项目列表
export const deleteLegSerNextservice = params => {
  return axios.delete(`legal/services/group/delete`, params).then(res => res.data)
}
// 绿化环境
export const EnvGreList = params => {
  return axios.get(`afforest/page/afforest/company/name`, params).then(res => res.data)
}
// 添加
export const addEnvGre = params => {
  return axios.post(`afforest/create`, params).then(res => res.data)
}
// 编辑
export const editEnvGre = params => {
  return axios.post(`afforest/update_one`, params).then(res => res.data)
}
// 删除
export const deleteEnvGre = params => {
  return axios.delete(`afforest/delete`, params).then(res => res.data)
}
// 获取单个信息
export const EnvGreoneList = params => {
  return axios.get(`afforest/page/one?afforestId=${params}`).then(res => res.data)
}
// 添加服务需求
export const addEnvGreservice = params => {
  return axios.post(`afforest/group/create`, params).then(res => res.data)
}
// 服务需求列表
export const addEnvGreservicelist = params => {
  return axios.get(`afforest/group/page`, params).then(res => res.data)
}
// 删除列表
export const deleteEnvGreservice = params => {
  return axios.delete(`afforest/group/delete`, params).then(res => res.data)
}
// 装修服务
export const DecSerList = params => {
  return axios.get(`fitment/page/fitment`, params).then(res => res.data)
}
// 添加
export const addDecSer = params => {
  return axios.post(`fitment/create`, params).then(res => res.data)
}
// 编辑
export const editDecSer = params => {
  return axios.post(`fitment/update_one`, params).then(res => res.data)
}
// 删除
export const deleteDecSer = params => {
  return axios.delete(`fitment/delete`, params).then(res => res.data)
}
// 获取单个信息
export const DecSeroneList = params => {
  return axios.get(`fitment/page/one?fitmentId=${params}`).then(res => res.data)
}
// 添加服务需求
export const addDecSerservice = params => {
  return axios.post(`fitment/group/create`, params).then(res => res.data)
}
// 服务需求列表
export const addDecSerservicelist = params => {
  return axios.get(`fitment/group/page`, params).then(res => res.data)
}
// 删除列表
export const deleteDecSerservice = params => {
  return axios.delete(`fitment/group/delete`, params).then(res => res.data)
}
// IT云服务
export const ITSerList = params => {
  return axios.get(`cloud/services/page/cloud/company/name`, params).then(res => res.data)
}
// 添加
export const addITSer = params => {
  return axios.post(`cloud/services/create`, params).then(res => res.data)
}
// 编辑
export const editITSer = params => {
  return axios.post(`cloud/services/update_one`, params).then(res => res.data)
}
// 删除
export const deleteITSer = params => {
  return axios.delete(`cloud/services/delete`, params).then(res => res.data)
}
// 宽带固话
export const PhoneList = params => {
  return axios.get(`broadband/page/broadband/company/name`, params).then(res => res.data)
}
// 添加
export const addPhone = params => {
  return axios.post(`broadband/create`, params).then(res => res.data)
}
// 编辑
export const editPhone = params => {
  return axios.post(`broadband/update_one`, params).then(res => res.data)
}
// 删除
export const deletePhone = params => {
  return axios.delete(`broadband/delete`, params).then(res => res.data)
}
// 获取单个信息
export const PhoneoneList = params => {
  return axios.get(`broadband/page/one?broadbandId=${params}`).then(res => res.data)
}
// 添加服务需求
export const addPhoneservice = params => {
  return axios.post(`broadband/group/create`, params).then(res => res.data)
}
// 服务需求列表
export const addPhoneservicelist = params => {
  return axios.get(`broadband/group/page`, params).then(res => res.data)
}
// 删除列表
export const deletePhoneservice = params => {
  return axios.delete(`broadband/group/delete`, params).then(res => res.data)
}
// 租赁备案
export const RentList = params => {
  return axios.get(`record/the/contract/page/record/the/contract`, params).then(res => res.data)
}
// 添加
export const addRent = params => {
  return axios.post(`record/the/contract/create`, params).then(res => res.data)
}
// 编辑
export const editRent = params => {
  return axios.post(`record/the/contract/update_one`, params).then(res => res.data)
}
// 删除
export const deleteRent = params => {
  return axios.delete(`record/the/contract/delete`, params).then(res => res.data)
}
// 获取单个信息
export const RentoneList = params => {
  return axios.get(`record/the/contract/page/one?contractId=${params}`).then(res => res.data)
}
// 添加服务类型
export const addRentservice = params => {
  return axios.post(`record/the/contract/group/create`, params).then(res => res.data)
}
// 服务类型列表
export const addRentservicelist = params => {
  return axios.get(`record/the/contract/group/page`, params).then(res => res.data)
}
// 删除类型列表
export const deleteRentservice = params => {
  return axios.delete(`record/the/contract/group/delete`, params).then(res => res.data)
}
// 政策申报
export const ParSerList = params => {
  return axios.get(`policy/declare/page/policy/declare`, params).then(res => res.data)
}
// 添加
export const addParSer = params => {
  return axios.post(`policy/declare/create`, params).then(res => res.data)
}
// 编辑
export const editParSer = params => {
  return axios.post(`policy/declare/update_one`, params).then(res => res.data)
}
// 删除
export const deleteParSer = params => {
  return axios.delete(`policy/declare/delete`, params).then(res => res.data)
}
// 政策申报列表
export const ParSerlistList = params => {
  return axios.get(`policy/page/policy/title`, params).then(res => res.data)
}
// 添加
export const addParSerlist = params => {
  return axios.post(`policy/create`, params).then(res => res.data)
}
// 编辑
export const editParSerlist = params => {
  return axios.post(`policy/update_one`, params).then(res => res.data)
}
// 删除
export const deleteParSerlist = params => {
  return axios.delete(`policy/delete`, params).then(res => res.data)
}
// 首页轮播图
export const slidelist = params => {
  return axios.get(`wx/slideshow/page/list`, params).then(res => res.data)
}
// 添加
export const addslide = params => {
  return axios.post(`slide_show/create`, params).then(res => res.data)
}
// 编辑
export const editslide = params => {
  return axios.post(`slide_show/update_one`, params).then(res => res.data)
}
// 删除
export const deleteslide = params => {
  return axios.delete(`slide_show/delete`, params).then(res => res.data)
}
// 园区展示查询单个
export const showonelist = params => {
  return axios.get(`park/show/page/one`, params).then(res => res.data)
}
// 编辑
export const editshow = params => {
  return axios.post(`park/show//update`, params).then(res => res.data)
}
// 招聘信息查询单个
export const recruitmentlist = params => {
  return axios.get(`recruitment/information/page`, params).then(res => res.data)
}
// 编辑
export const editrecruitment = params => {
  return axios.post(`recruitment/information//update`, params).then(res => res.data)
}




















// 获取角色列表
export const getRoleList = params => {
  return axios.get('roles').then(res => res.data)
}
// 分配角色
export const grantUserRole = params => {
  return axios.put(`users/${params.id}/role`, {id: params.id, rid: params.rid}).then(res => res.data)
}
// 获取权限列表
export const getRightList = params => {
  return axios.get(`rights/${params.type}`).then(res => res.data)
}
// 删除角色
export const delRoleRight = params => {
  return axios.delete(`roles/${params}`).then(res => res.data)
}
// 删除角色指定权限
export const deleteRoleRight = params => {
  return axios.delete(`roles/${params.roleId}/rights/${params.rightId}`).then(res => res.data)
}
// 根据ID查询角色
export const getRoleById = params => {
  return axios.get(`roles/${params}`).then(res => res.data)
}
// 编辑提交角色
export const editRoleRight = params => {
  return axios.put(`roles/${params.id}`, params).then(res => res.data)
}
// 角色授权
export const grantRoleRight = (roleId, rids) => {
  return axios.post(`roles/${roleId}/rights`, rids).then(res => res.data)
}
// 添加角色
export const addRoleRight = (params) => {
  return axios.post('roles', params).then(res => res.data)
}
// 左侧菜单权限
export const getMenus = () => {
  return axios.get('menus').then(res => res.data)
}
// 获取商品分类信息
export const getCategories = (params) => {
  return axios.get('categories', {params: params}).then(res => res.data)
}
// 添加分类
export const addCategories = params => {
  return axios.post('categories', params).then(res => res.data)
}
// 商品管理编辑角色
export const editCategoriesRight = params => {
  return axios.put(`categories/${params.cat_id}`, params).then(res => res.data)
}
// 商品管理编辑根据ID查询角色
export const getCategoriesById = params => {
  return axios.get(`categories/${params}`).then(res => res.data)
}
// 商品管理删除分类
export const delCategoriesRight = params => {
  return axios.delete(`categories/${params}`).then(res => res.data)
}

// goods商品列表
export const getGoodsList = params => {
  return axios.get('goods',params).then(res => res.data)
}
// goods商品列表添加
export const addgoods = params => {
  return axios.post('goods', params).then(res => res.data)
}
// 参数列表
export const addparams = params => {
  return axios.get(`/${params.id}/attributes`).then(res => res.data)
}
// 订单数据列表
export const addorders = params => {
  return axios.get('orders',params).then(res => res.data)
}
// 修改订单状态
export const editorders = params => {
  return axios.put(`orders/${params}`).then(res => res.data)
}
// 查看订单详情
export const getordersById = params => {
  return axios.get(`orders/${params}`).then(res => res.data)
}
// 基于类型统计（饼图）
export const addreportsone = params => {
  return axios.get(`report/${params.type}`).then(res => res.data)
}